package com.road.entity;

import java.sql.Timestamp;

import com.road.entity.base.DataObject;
import com.road.entity.base.Option;

public class QuestData extends DataObject {
	/**
	 * userId
	 */
	private int userId;

	/**
	 * templateId
	 */
	private int templateId;

	/**
	 * isComplete
	 */
	private boolean isComplete;

	private Timestamp addDate;

	/**
	 * completedDate
	 */
	private Timestamp completedDate;

	/**
	 * condition1
	 */
	private int condition1;

	/**
	 * condition2
	 */
	private int condition2;

	/**
	 * condition3
	 */
	private int condition3;

	/**
	 * condition4
	 */
	private int condition4;

	/**
	 * repeatFinish
	 */
	private int repeatFinish;

	private boolean isSelect;
	/**
	 * isExist
	 */
	private boolean isExist;

	/**
	 * 取得userId
	 * 
	 * @return userId
	 */
	public int getUserId() {
		return this.userId;
	}

	/**
	 * 设置userId
	 * 
	 * @param 新的userId
	 */
	public void setUserId(int userId) {
		if (this.userId != userId) {
			this.userId = userId;
			setOp(Option.Update);
		}
	}

	/**
	 * 取得templateId
	 * 
	 * @return templateId
	 */
	public int getTemplateId() {
		return this.templateId;
	}

	/**
	 * 设置templateId
	 * 
	 * @param 新的templateId
	 */
	public void setTemplateId(int templateId) {
		if (this.templateId != templateId) {
			this.templateId = templateId;
			setOp(Option.Update);
		}
	}

	/**
	 * 取得isComplete
	 * 
	 * @return isComplete
	 */
	public boolean getIsComplete() {
		return this.isComplete;
	}

	/**
	 * 设置isComplete
	 * 
	 * @param 新的isComplete
	 */
	public void setIsComplete(boolean isComplete) {
		if (this.isComplete != isComplete) {
			this.isComplete = isComplete;
			setOp(Option.Update);
		}
	}

	/**
	 * 取得completedDate
	 * 
	 * @return completedDate
	 */
	public Timestamp getCompletedDate() {
		return this.completedDate;
	}

	/**
	 * 设置completedDate
	 * 
	 * @param 新的completedDate
	 */
	public void setCompletedDate(Timestamp completedDate) {
		if (this.completedDate != completedDate) {
			this.completedDate = completedDate;
			setOp(Option.Update);
		}
	}

	/**
	 * 取得condition1
	 * 
	 * @return condition1
	 */
	public int getCondition1() {
		return this.condition1;
	}

	/**
	 * 设置condition1
	 * 
	 * @param 新的condition1
	 */
	public void setCondition1(int condition1) {
		if (this.condition1 != condition1) {
			this.condition1 = condition1;
			this.setOp(Option.Update);
		}
	}

	/**
	 * 取得condition2
	 * 
	 * @return condition2
	 */
	public int getCondition2() {
		return this.condition2;
	}

	/**
	 * 设置condition2
	 * 
	 * @param 新的condition2
	 */
	public void setCondition2(int condition2) {
		if (this.condition2 != condition2) {
			this.condition2 = condition2;
			setOp(Option.Update);
		}
	}

	/**
	 * 取得condition3
	 * 
	 * @return condition3
	 */
	public int getCondition3() {
		return this.condition3;
	}

	/**
	 * 设置condition3
	 * 
	 * @param 新的condition3
	 */
	public void setCondition3(int condition3) {
		if (this.condition3 != condition3) {
			this.condition3 = condition3;
			setOp(Option.Update);
		}
	}

	/**
	 * 取得condition4
	 * 
	 * @return condition4
	 */
	public int getCondition4() {
		return this.condition4;
	}

	/**
	 * 设置condition4
	 * 
	 * @param 新的condition4
	 */
	public void setCondition4(int condition4) {
		if (this.condition4 != condition4) {
			this.condition4 = condition4;
			setOp(Option.Update);
		}
	}

	/**
	 * 取得repeatFinish
	 * 
	 * @return repeatFinish
	 */
	public int getRepeatFinish() {
		return this.repeatFinish;
	}

	/**
	 * 设置repeatFinish
	 * 
	 * @param 新的repeatFinish
	 */
	public void setRepeatFinish(int repeatFinish) {
		if (this.repeatFinish != repeatFinish) {
			this.repeatFinish = repeatFinish;
			setOp(Option.Update);
		}
	}

	public void setAddDate(Timestamp addDate) {
		if (this.addDate != addDate) {
			this.addDate = addDate;
			setOp(Option.Update);
		}
	}

	public Timestamp getAddDate() {
		return addDate;
	}

	/**
	 * 取得isExist
	 * 
	 * @return isExist
	 */
	public boolean getIsExist() {
		return this.isExist;
	}

	/**
	 * 设置isExist
	 * 
	 * @param 新的isExist
	 */
	public void setIsExist(boolean isExist) {
		if (this.isExist != isExist) {
			this.isExist = isExist;
			setOp(Option.Update);
		}
	}

	public int getCondictionValue(int index) {
		switch (index) {
		case 0:
			return getCondition1();
		case 1:
			return getCondition2();
		case 2:
			return getCondition3();
		case 3:
			return getCondition4();
		default:
			return -1;
		}
	}

	public void saveCondictionValue(int index, int value) {
		switch (index) {
		case 0:
			setCondition1(value);
			break;
		case 1:
			setCondition2(value);
			break;
		case 2:
			setCondition3(value);
			break;
		case 3:
			setCondition4(value);
			break;
		default:
			LOGGER.warn("设置用户任务记录越界！");
			break;
		}
	}

	/**
	 * 调试用的方法， 可以将所有字段的数据输出
	 * 
	 */
	public String toString() {
		StringBuffer sb = new StringBuffer();

		sb.append("userId:		" + userId + "\n");
		sb.append("templateId:		" + templateId + "\n");
		sb.append("isComplete:		" + isComplete + "\n");
		sb.append("completedDate:		" + completedDate + "\n");
		sb.append("condition1:		" + condition1 + "\n");
		sb.append("condition2:		" + condition2 + "\n");
		sb.append("condition3:		" + condition3 + "\n");
		sb.append("condition4:		" + condition4 + "\n");
		sb.append("repeatFinish:		" + repeatFinish + "\n");
		sb.append("isExist:		" + isExist + "\n");

		return sb.toString();
	}

	public void setIsSelect(boolean isSelect) {
		this.isSelect = isSelect;
	}

	public boolean getIsSelect() {
		return isSelect;
	}

}
